<?php
	require_once("connect.php");
	
	$sql="select * from loai";
	$query=mysql_query($sql);
	while($row=mysql_fetch_assoc($query))
	{
		$loai[]=$row;
	}
	
	$sql="select * from theloai group by tentheloai";
	$query=mysql_query($sql);
	while($row=mysql_fetch_assoc($query))
	{
		$dt[]=$row;
	}
	
	$sql="select * from quocgia group by tenquocgia";
	$query=mysql_query($sql);
	while($row=mysql_fetch_assoc($query))
	{
		$qg[]=$row;
	}
	
	$sql="select * from chuyenngu group by tenchuyenngu";
	$query=mysql_query($sql);
	while($row=mysql_fetch_assoc($query))
	{
		$cn[]=$row;
	}
	
	$sql="select * from chatluong group by tenchatluong";
	$query=mysql_query($sql);
	while($row=mysql_fetch_assoc($query))
	{
		$cl[]=$row;
	}

	
?>
<ul>
	<li>
    	<a href="javascript:void(0)" class="maloai">Phim Lẻ</a>
        <ul>            
        	<?php
				foreach($dt as $item)
				{
					echo "<li><a href='index.php?key=theloai&id=".$item['matheloai']."&name=".$item['tentheloai']."' id='".$item['matheloai']."' class='matheloai' >Phim $item[tentheloai]</a></li>";
				}
			?>
        </ul>
    </li>
    <li>
    	<a href="javascript:void(0)" class="maloai">Phim Bộ</a>
        <ul>
        	<?php
				foreach($qg as $item)
				{
					echo "<li><a href='index.php?key=quocgia&id=".$item['maquocgia']."&name=".$item['tenquocgia']."' id='".$item['maquocgia']."' class='matheloai' >Phim $item[tenquocgia]</a></li>";
				}
			?>
        </ul>
    </li>
    <li>
    	<a href="javascript:void(0)" class="maloai">Phim Chuyển Ngữ</a>
        <ul>
        	<?php
				foreach($cn as $item)
				{
					echo "<li><a href='index.php?key=chuyenngu&id=".$item['machuyenngu']."&name=".$item['tenchuyenngu']."' id='".$item['machuyenngu']."' class='matheloai' >Phim $item[tenchuyenngu]</a></li>";
				}
			?>
        </ul>
    </li>
    <li>
    	<a href="javascript:void(0)" class="maloai">Phim Chất Lượng</a>
        <ul>
        	<?php
				foreach($cl as $item)
				{
					echo "<li><a href='index.php?key=chatluong&id=".$item['machatluong']."&name=".$item['tenchatluong']."' id='".$item['machatluong']."' class='matheloai' >Phim $item[tenchatluong]</a></li>";
				}
			?>
        </ul>
    </li>
    <li>
    	<a href="index.php?key=mostviewed ">Phim HOT</a>
    </li>
    <li>
    	 <a href="index.php?key=req" class="email" id="request">Yêu cầu phim</a>
    </li>
    <li>
    	<a href="index.php?key=contact" class="phone" id="contact">Liên hệ quảng cáo</a>
    </li>
</ul>
<?php
//	echo "<pre>";
//	print_r($loai);
//	echo "</pre>";
//	echo $loai[0]['tenloai']
?>